<?php
// namespace demo;
/**
 *
 * @authors  Ysg (y.shi.guo@gmail.com)
 * @website  http://ysg.bonza.cn
 * @date     2017-07-24 11:43:02
 */

header("Content-type:text/html;charset:utf8;");
header("Pragma: no-cache");
header("Pragma: no-cache");

date_default_timezone_set('PRC');

define("ROOT_PATH",realpath('.'));


/*$subject = 'Aaaaaa Bbb';

preg_replace_callback_array(
    [
        '/[a]+/i' => function ($match) {
            // echo strlen($match[0]), ' matches for "a" found', "<br/>";
            echo $match[0], ' matches for "a" found', "<br/>";
        },
        '/[b]+/i' => function ($match) {
            echo strlen($match[0]), ' matches for "b" found', "<br/>";
        }
    ],
    $subject
);*/

//模式分隔符后的"i"标记这是一个大小写不敏感的搜索
/*if (preg_match("/hoifun/i", "PHP is the web hoifun.pdf language hoifun of choice.",$matches)) {
    echo "查找到匹配的字符串";
    echo "<br/>";
    print_r($matches);
} else {
    echo "未发现匹配的字符串";
}
*/
// 从URL中获取主机名称
/*preg_match('@^(?:http://)?([^/]+)@i',
    "http://www.runoob.com/index.html", $matches);
$host = $matches[1];

// 获取主机名称的后面两部分
preg_match('/[^.]+\.[^.]+$/', $host, $matches);
echo "domain name is: {$matches[0]}\n";*/

$userinfo = "Name: <b>PHP</b> <br> Title: <b>Programming Language</b>";
preg_match_all ("~<b>(.*)<\/b>~U", $userinfo, $pat_array);
print_r($pat_array);






















